<?php


class NTheme extends NObject{

var $name="default";
var $charset="UTF-8";
function &getInstance ()

    // this implements the 'singleton' design pattern.

    {

        static $instance;

        

        if (!isset($instance)) {

            $c = __CLASS__;

            $instance = new $c;

        } // if

        

        return $instance;

        

    } // getInstance
function __construct(){
	$this->setTheme();

}


function setTheme($name="default"){
if (!$name) $name="default";
$this->set("name",$name);
$this->set("baseurl",THEMES_URL."/".$this->get('name'));
$this->set("basedir",THEMES_DIR."/".$this->get('name'));
}
function render(){
	global $theme_layout;
$theme_file = "index.phtml";
if ($theme_layout) {
  $theme_file = "index_$theme_layout.phtml";
}
ob_start();
include $this->get("basedir")."/$theme_file";
$_return=ob_get_contents();
ob_clean();
return $_return;
}
}
?>